﻿// --------------------------------
// <copyright file="ProductFilters.cs" company="OpenTicket">
//     Microsoft Public License (Ms-PL)
// </copyright>
// <author>Glenn</author>
// ---------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OpenTicket.Repositories
{
    /// <summary>
    /// Filters for products
    /// </summary>
    public static class ProductFilters
    {
        /// <summary>
        /// Filter on ProductCode
        /// </summary>
        /// <param name="query">The query.</param>
        /// <param name="productCode">The product code.</param>
        /// <returns>The modified query</returns>
        public static IQueryable<OpenTicket.Model.Product> WithId(this IQueryable<OpenTicket.Model.Product> query, string productCode)
        {
            return from p in query where p.ProductCode.Equals(productCode) select p;
        }
    }
}
